<?php
include('connections/db_connection.php');

//Get Active Categories
$result = mysql_query("SELECT * FROM `categories` WHERE active = 1");

$category_menu = "";

while ($row = mysql_fetch_array($result)) {
    $category_menu .= '<li><a href="products.php?cid=' . $row['category_id'] . '">'.$row['category'].'</a></li>';
}

if(isset($_POST['search'])){
    header('Location: search.php?string='.$_POST['string']);
}

?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <title>Miyako.lk</title>
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/font-awesome.min.css" rel="stylesheet">
        <link href="css/prettyPhoto.css" rel="stylesheet">
        <link href="css/price-range.css" rel="stylesheet">
        <link href="css/animate.css" rel="stylesheet">
        <link href="css/main.css" rel="stylesheet">
        <link href="css/responsive.css" rel="stylesheet">

        <link rel="shortcut icon" href="images/home/favicon.png">
    </head>

    <body>
        <header id="header">
            <div class="header_top">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="contactinfo">
                                <ul class="nav nav-pills">
                                    <li><a href="tel:+94112344196"><i class="fa fa-phone"></i> +94-11-2344196 </a></li>
                                    <li><a href="mailto:info@miyako.lk"><i class="fa fa-envelope"></i> info@miyako.lk</a></li>
                                </ul>
                            </div>
                        </div>                      
                        <div class="col-sm-6">
                            
                            <form action="search.php" method="post" class="pull-right">
                                    <div class="search_box pull-left">
                                <input type="text" name ="string" id ="string" placeholder="Search"/>
                                </div>
                                <div class="search_box_btn pull-right">
                                    <input type="submit" name="search" id="search" value="">
                                </div>
                                </form>
                            						
<!--                            <div class="social-icons pull-left">
                                <ul class="nav navbar-nav">
                                    <li><a href="http://facebook.com" target="_blank"><i class="fa fa-facebook"></i></a></li>
                                    <li><a href="httpe://twitter.com" target="_blank"><i class="fa fa-twitter"></i></a></li>
                                    <li><a href="https://plus.google.com/" target="_blank"><i class="fa fa-google-plus"></i></a></li>
                                </ul>
                            </div>-->

                        </div>
                    </div>
                </div>
            </div>

            <div class="header-middle">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-4">
                            <div class="logo pull-left">
                                <a href="index.php"><img height = "50px" src="images/home/miyako_logo.png" alt="" /></a>
                            </div>
                            <div class="container">
                                <div class="row">
                                    <div class="col-sm-10">
                                        <div class="navbar-header pull-right">
                                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                                                <span class="sr-only">Toggle navigation</span>
                                                <span class="icon-bar"></span>
                                                <span class="icon-bar"></span>
                                                <span class="icon-bar"></span>
                                            </button>
                                        </div>
                                        <div class="mainmenu pull-right">
                                            <ul class="nav navbar-nav collapse navbar-collapse">

                                                <li><a href="index.php" class="active">HOME</a></li>
                                                <li class="dropdown"><a href="aboutus.php">ABOUT US</a></li> 
                                                <li class="dropdown"><a href="products.php">PRODUCTS<i class="fa fa-angle-down"></i></a>
                                                    <ul role="menu" class="sub-menu">
                                                        <?php print $category_menu; ?>
                                                    </ul>
                                                </li> 
                                                <!--<li><a href="feedback.php">FEEDBACK</a></li>-->
                                                <li><a href="contactus.php">CONTACT US</a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </header>